﻿<Canvas xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:MagicControls="clr-namespace:MagicControls;assembly=ClientBin/MagicControls.dll"
        >
  <Canvas.Resources>
    <Storyboard x:Name="thumb_ScrollAnimation_Down" Completed="thumb_ScrollAnimation_Down_Completed">
      <DoubleAnimation
          Storyboard.TargetName="thumb"
          Storyboard.TargetProperty="(Canvas.Top)"
          By="1" Duration="0:0:0.001"/>
    </Storyboard>
    <Storyboard x:Name="thumb_ScrollAnimation_Up" Completed="thumb_ScrollAnimation_Up_Completed">
      <DoubleAnimation
          Storyboard.TargetName="thumb"
          Storyboard.TargetProperty="(Canvas.Top)"
          By="-1" Duration="0:0:0.001"/>
    </Storyboard>
    <Storyboard x:Name="thumb_ScrollAnimation_Right" Completed="thumb_ScrollAnimation_Down_Completed">
      <DoubleAnimation
          Storyboard.TargetName="thumb"
          Storyboard.TargetProperty="(Canvas.Left)"
          By="-1" Duration="0:0:0.001"/>
    </Storyboard>
    <Storyboard x:Name="thumb_ScrollAnimation_Left" Completed="thumb_ScrollAnimation_Up_Completed">
      <DoubleAnimation
          Storyboard.TargetName="thumb"
          Storyboard.TargetProperty="(Canvas.Left)"
          By="1" Duration="0:0:0.001"/>
    </Storyboard>
  </Canvas.Resources>
  <MagicControls:CanvasBase x:Name="down" Canvas.ZIndex="2" SizeChanged="down_SizeChanged">
    <Canvas.Resources>
      <Storyboard x:Name="down_ClickButton">
        <DoubleAnimation
          Storyboard.TargetName="down_MainRectMoover"
          Storyboard.TargetProperty="X"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="down_MainRectMoover"
          Storyboard.TargetProperty="Y"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="down_WhiteRectMoover"
          Storyboard.TargetProperty="X"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="down_WhiteRectMoover"
          Storyboard.TargetProperty="Y"
          From="0" To="1" Duration="0:0:0"/>
      </Storyboard>
      <Storyboard x:Name="down_ReturnButton">
        <DoubleAnimation
          Storyboard.TargetName="down_MainRectMoover"
          Storyboard.TargetProperty="X"
          From="1" To="0" Duration="0:0:0.2"/>
        <DoubleAnimation
          Storyboard.TargetName="down_MainRectMoover"
          Storyboard.TargetProperty="Y"
          From="1" To="0" Duration="0:0:0.2"/>
        <DoubleAnimation
          Storyboard.TargetName="down_WhiteRectMoover"
          Storyboard.TargetProperty="X"
          From="1" To="0" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="down_WhiteRectMoover"
          Storyboard.TargetProperty="Y"
          From="1" To="0" Duration="0:0:0"/>
      </Storyboard>
    </Canvas.Resources>
    <Canvas x:Name="down_MainRect" Background="#FFBBBBBB" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="4"
            MouseLeftButtonDown="down_MainRect_MouseLeftButtonDown"
            MouseLeftButtonUp="down_MainRect_MouseLeftButtonUp"
            MouseLeave="down_MainRect_MouseLeave">
      <Canvas.RenderTransform>
        <TranslateTransform x:Name="down_MainRectMoover" X="0" Y="0" />
      </Canvas.RenderTransform>
      <Polygon x:Name="down_Arrow" Fill="Black"/>
    </Canvas>
    <Rectangle x:Name="down_GrayBorder" Fill="#FFAAAAAA" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="3">
    </Rectangle>
    <Rectangle x:Name="down_BlackBorder" Fill="#FF000000" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="1">
    </Rectangle>
    <Rectangle x:Name="down_WhiteBorder" Fill="#FFDDDDDD" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="2">
      <Rectangle.RenderTransform>
        <TranslateTransform x:Name="down_WhiteRectMoover" X="0" Y="0" />
      </Rectangle.RenderTransform>
    </Rectangle>
  </MagicControls:CanvasBase>
  <MagicControls:CanvasBase x:Name="up" Canvas.ZIndex="2" SizeChanged="up_SizeChanged">
    <Canvas.Resources>
      <Storyboard x:Name="up_ClickButton">
        <DoubleAnimation
          Storyboard.TargetName="up_MainRectMoover"
          Storyboard.TargetProperty="X"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="up_MainRectMoover"
          Storyboard.TargetProperty="Y"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="up_WhiteRectMoover"
          Storyboard.TargetProperty="X"
          From="0" To="1" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="up_WhiteRectMoover"
          Storyboard.TargetProperty="Y"
          From="0" To="1" Duration="0:0:0"/>
      </Storyboard>
      <Storyboard x:Name="up_ReturnButton">
        <DoubleAnimation
          Storyboard.TargetName="up_MainRectMoover"
          Storyboard.TargetProperty="X"
          From="1" To="0" Duration="0:0:0.2"/>
        <DoubleAnimation
          Storyboard.TargetName="up_MainRectMoover"
          Storyboard.TargetProperty="Y"
          From="1" To="0" Duration="0:0:0.2"/>
        <DoubleAnimation
          Storyboard.TargetName="up_WhiteRectMoover"
          Storyboard.TargetProperty="X"
          From="1" To="0" Duration="0:0:0"/>
        <DoubleAnimation
          Storyboard.TargetName="up_WhiteRectMoover"
          Storyboard.TargetProperty="Y"
          From="1" To="0" Duration="0:0:0"/>
      </Storyboard>
    </Canvas.Resources>
    <Canvas x:Name="up_MainRect" Background="#FFBBBBBB" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="4"
             MouseLeftButtonDown="up_MainRect_MouseLeftButtonDown" MouseLeftButtonUp="up_MainRect_MouseLeftButtonUp">
      <Canvas.RenderTransform>
        <TranslateTransform x:Name="up_MainRectMoover" X="0" Y="0" />
      </Canvas.RenderTransform>
      <Polygon x:Name="up_Arrow" Fill="Black"/>
    </Canvas>
    <Rectangle x:Name="up_GrayBorder" Fill="#FFAAAAAA" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="3">
    </Rectangle>
    <Rectangle x:Name="up_BlackBorder" Fill="#FF000000" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="1">
    </Rectangle>
    <Rectangle x:Name="up_WhiteBorder" Fill="#FFDDDDDD" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="2">
      <Rectangle.RenderTransform>
        <TranslateTransform x:Name="up_WhiteRectMoover" X="0" Y="0" />
      </Rectangle.RenderTransform>
    </Rectangle>
  </MagicControls:CanvasBase>
  <MagicControls:CanvasBase x:Name="thumb" Canvas.ZIndex="2" SizeChanged="thumb_SizeChanged">
    <Rectangle x:Name="thumb_MainRect" Fill="#FFBBBBBB" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="4">
    </Rectangle>
    <Rectangle x:Name="thumb_GrayBorder" Fill="#FFAAAAAA" Canvas.Left="1" Canvas.Top="1" Canvas.ZIndex="3">
    </Rectangle>
    <Rectangle x:Name="thumb_BlackBorder" Fill="#FF000000" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="1">
    </Rectangle>
    <Rectangle x:Name="thumb_WhiteBorder" Fill="#FFDDDDDD" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="2">
    </Rectangle>
  </MagicControls:CanvasBase>
  <MagicControls:CanvasBase x:Name="track" Canvas.ZIndex="1" Background="#FFDDDDDD">
  </MagicControls:CanvasBase>
</Canvas>